% computes target frequency, target lines and radius 
% for current block size;
% note Parzen window sizes are hard written here
% part of Mt processing codes
% usage [TLine,TLRad,TLFreq,TBand] =  SetTLine(block)
% latest date 07.11.2001
%made changes for satellite induction problem 6oct05
% strictly for black sizes 128 - 4096

function[TLine,TLRad,TLFreq] =  SetTLine_S(TLFreq,DeltaFreq,Parzen,block),
	
ff = fftfrq(block,DeltaFreq*1024);
MinFreq = ff(1);
MaxFreq = ff(end);

for Index = 1:length(TLFreq),
    
    if TLFreq(Index) <= MinFreq,
      TLFreq(Index)  = MinFreq;
    elseif TLFreq(Index) >= MaxFreq,
      TLFreq(Index)  = MaxFreq;
    end;


%    -  set targetlines and band                            
%    -  targetlines are set for block size of 1024 points 

      TLine(Index) =  floor(TLFreq(Index) / DeltaFreq(1) + 0.5);

%   -- set correct targetline in respect to block 

	if block == 128,
	TLine(Index) = round((TLine(Index) +1 ) / 8);
	elseif block == 256,
	TLine(Index) = round((TLine(Index) +1) / 4);
	elseif block == 512,
	TLine(Index) = round((TLine(Index)) / 2);
	elseif block == 1024,
	TLine(Index) = TLine(Index);
	elseif block == 2048,
	TLine(Index) = round((TLine(Index) +1) * 2);
	elseif block == 4096,
	TLine(Index) = round((TLine(Index) +1) * 4);
end;



%------  set radius  ---------------------------------------


	TLRad(Index) = floor(TLine(Index) * Parzen + 0.5 );

%----- check radius boundaries 

    if TLRad(Index)+TLine(Index) > block/2,
    TLRad(Index) = block/2-TLine(Index);
    elseif TLRad(Index)- TLine(Index) < 1,
        TRad(Index) = TLine(Index) - 1;
    end;

end;


